<template>
	<view v-show="show == true" class="" style="min-height: 400rpx;">
		<view class="tn-margin-sm">
			<view class="tn-text-lg tn-text-bold clamp-text-1 tn-text-justify">
				<text class="">分值分布占比</text>
			</view>
		</view>
		<qiun-data-charts canvas2d type="pie" :opts="categoryOpts" :chartData="categoryChartData" />
	</view>
</template>

<script>
	export default {
		components: {},
		data() {
			return {
				show:true,
				// 品类库存
				categoryChartData: {},


				categoryOpts: {
					rotate: false,
					rotateLock: false,
					color: ["#4B98FE", "#00D05E", "#FFAC00", "#FB6A67", "#957BFE", "#00B9FE", "#FE871B", "#00C8B0",
						"#F674D6"
					],
					padding: [15, 10, 15, 10],
					dataLabel: true,
					enableScroll: false,
					legend: {
						show: true,
						position: "left",
						lineHeight: 32
					},
					title: {
						name: "",
						fontSize: 15,
						color: "#666666"
					},
					subtitle: {
						name: "",
						fontSize: 25,
						color: "#4B98FE"
					},
					extra: {
						pie: {
							activeOpacity: 0.5,
							activeRadius: 10,
							offsetAngle: -90,
							labelWidth: 15,
							border: true,
							borderWidth: 2,
							borderColor: "#FFFFFF",
						}
					}
				},


			}
		},
		props: {

		},

		methods: {
			drawAbilityCharts(info) {
				if (info.backInfo == '查看详情' || info.backInfo == '查看详细' ){
					this.show = false;
				} else {
					this.show = true;
				}
				
				
				if (info.resultList.length) {
					var pieList = []
					info.resultList.forEach((item, index) => {
						var name = '';
						if (info.subjectModel.records_type == 'score') {
							name = item.score_start + '-' + item.score_end + '分'
						} else {
							name = item.type_name
						}
						var singleItem = {
							name: name,
							value: item.proportion
						}
						pieList.push(singleItem);
					});
					var data = {
						data: pieList,
					}
					var series = {
						series: [data]
					}


					this.categoryChartData = JSON.parse(JSON.stringify(series));

				}
			},



		}
	}
</script>

<style lang='scss' scoped>

</style>